<?php

namespace App\Models;

/**
 * Class Sale
 * @property string title
 * @property string sub_title
 * @property float price
 * @property boolean status
 * @property date start_time
 * @property date end_time
 */
class RechargeGift extends ApplicationModel
{
    protected $fillable = [
        'rmb',
        'coin',
        'type',
        'status',
        'sort',
        'start_time',
        'end_time',
        'remark',
    ];

    public function scopeRelease($query)
    {
        return $query->where('start_time', '<=', date('Y-m-d H:i:s'))->where('end_time', '>=', date('Y-m-d H:i:s'));
    }

    public function rechargeGiftRelation()
    {
        return $this->hasMany(RechargeGiftRelation::class);
    }
}
